
var WxParse = require('../components/wxParse/wxParse.js');
import apiTransformApi from '../../yali-sdk/business/live/api/apiTransformApi';
import { SUCCESS } from '../../yali-sdk/utils/success';
import { FAIL } from '../../yali-sdk/utils/fail';

Page({
  data: {
    art: {}
  },
  onReady: function () {
    wx.setNavigationBarTitle({
      title: '详情页面'
    })
  },
  onLoad: function (options) {
    var that = this
    const id =options.id;
       global.actionDispatcher.execute(apiTransformApi,{id,detail:'detail'}, (f,fs) => {
        if (f === SUCCESS) {
         const content = fs.data.body;
         let ipos = content.indexOf('<div class="view-more">'); //查找不显示的内容
         let str1 = ipos != -1 ? content.substring(0, ipos) : content; //取前部分
        if(content && content !==undefined){
            WxParse.wxParse('body','html',str1,that,5);
          }
          wx.setNavigationBarTitle({
            title: fs.data.title
          })
         that.setData({
           art: fs.data,
         })
        }
    });
  }
})
